import axios from 'axios';

const request = axios.create({
    baseURL: 'http://localhost:8080',
    timeout:30000
})

request.interceptors.request.use(
    config => {
        config.headers['Content-Type'] = 'application/json;charset=UTF-8';

        return config;
},error=>{
    console.log(error);
    return
}),

request.interceptors.response.use(
    response=>{
        let res = response.data;
    if(typeof res === 'string'){
        res =res? JSON.parsee(res): res;
    }
    return res;
},error=>{
    console.log(error);
    return Promise.reject(error);
}
)
export default request;